package com.qf.main.login.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.common.base.ex.ServiceException;
import com.qf.common.base.result.ResultStatus;
import com.qf.main.login.common.vo.SysUserVo;
import com.qf.main.login.entity.SysUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author chengqiang
 * @Create 2024-02-27-15:17
 * @Description:
 */
public interface SysUserMapper extends BaseMapper<SysUser> {
    default SysUser selectUserByName(String username) {
        QueryWrapper<SysUser> qw = new QueryWrapper<>();
        qw.eq(SysUser.COL_USERNAME, username);
        SysUser sysUser = this.selectOne(qw);

        return this.selectOne(qw);
    }

    default SysUser selectUserByPhone(String phone) {
        QueryWrapper<SysUser> qw = new QueryWrapper<>();
        qw.eq(SysUser.COL_PHONE, phone);
        SysUser sysUser = this.selectOne(qw);

        return this.selectOne(qw);
    }

    List<SysUserVo> selectUserList(@Param("username") String username, @Param("phone") String phone);

    Integer recoverUser(Integer id);
}
